home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / pt20pc.zip / ANASAZI.C next >
C/C++ Source or Header  |  1991-02-04  |  1KB  |  57 lines

  1. #include "pt.h"
  2. #include "malloc.h"
  3.  
  4. void pascal
  5. /* XTAG:processBlock */
  6. processBlock(ch, w, insertString, cp2, textAttr, selAttr)
  7.     unsigned char ch, insertString[];
  8.     struct window *w;
  9.     long *cp2;
  10.     unsigned char *textAttr, *selAttr;
  11. {
  12.     extern unsigned char msgBuffer[];
  13.     extern union REGS rin, rout;
  14.     extern struct SREGS segRegs;
  15.     extern unsigned char *userMessages[];
  16.     extern unsigned char *stktop;
  17.     extern int debug;
  18.  
  19.     unsigned int *p;
  20.     unsigned char *saveStktop;
  21.  
  22.     /* set up the argument to the interrupt in the registers */
  23.     rin.x.ax = (unsigned int)w;
  24.     rin.h.bl = *textAttr;
  25.     rin.h.bh = *selAttr;
  26.     rin.x.cx = (unsigned int)&insertString[0];
  27.     rin.x.dx = segRegs.ds;
  28.     p = (unsigned int *)cp2;
  29.     rin.x.si = *p++;
  30.     rin.x.di = *p;
  31.  
  32.     /* Ana will call us back so get up a stack for that */
  33.     saveStktop = stktop;
  34.     stktop = malloc(2048);
  35.     if( stktop == NULL ) {
  36.         msg(userMessages[NOSPACEMSG], 3);
  37.         return;
  38.     }
  39.     stktop += 2040;
  40.  
  41.     /* make the interrupt call */
  42.     int86(0x62, &rin, &rout);
  43.  
  44.     /* free the stack we were using */
  45.     stktop -= 2040;
  46.     free(stktop);
  47.     stktop = saveStktop;
  48.  
  49.     /* get the returned arguments out of the registers */
  50.     *textAttr = rout.h.bl;
  51.     *selAttr = rout.h.bh;
  52.     p = (unsigned int *)cp2;
  53.     *p++ = rout.x.si;
  54.     *p = rout.x.di;
  55. }
  56.  
  57.